<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:aui="http://liferay.com/faces/aui"
                xmlns:portlet="http://java.sun.com/portlet_2_0">

    <h:panelGroup id="viewIfeedDepartment" rendered="#{app.isInEditMode()}">
        <h:outputText style="font-weight: bold;" value="Förvaltning: "/>
        <br/>
        <h:selectOneMenu style="text-align:left;"
                         converter="departmentConverter"
                         update="viewIfeedDepartmentAndGroup"
                         ajax="true"
                         id="selectGovernanceForDetails"
                         rendered="#{app.isInEditMode()}"
                         immediate="true"
                         value="#{iFeedModelBean.department}">
            <f:selectItem itemLabel="-" itemValue="#{null}"/>
            <f:selectItems value="#{app.getVgrDepartments()}"
                           var="i" itemLabel="#{i.name}" itemValue="#{i}"/>
            <f:ajax render="viewIfeedDepartment"/>
            <f:ajax render="viewIfeedGroup"/>
        </h:selectOneMenu>
    </h:panelGroup>

    <h:panelGroup id="viewIfeedGroup" rendered="#{app.isInEditMode()}">
        <br/>
        <h:outputText style="font-weight: bold;" value="Grupp: " rendered="#{app.isInEditMode()}"/>
        <br/>
        <h:selectOneMenu style="text-align:left;"
                         converter="groupConverter"
                         update="viewIfeedDepartmentAndGroup"
                         ajax="true"
                         rendered="#{iFeedModelBean.department != null and app.isInEditMode()}"
                         value="#{iFeedModelBean.group}">
            <f:selectItem itemLabel="-" itemValue="#{null}"/>
            <f:selectItems value="#{iFeedModelBean.department.vgrGroups}"
                           var="i" itemLabel="#{i.name}" itemValue="#{i}"/>
            <f:ajax render="viewIfeedDepartment"/>
            <f:ajax render="viewIfeedGroup"/>
        </h:selectOneMenu>
    </h:panelGroup>

    <h:panelGroup rendered="#{!app.isInEditMode() and iFeedModelBean.department != null and !app.isInEditMode()}">
        <h:outputText style="font-weight: bold;" value="Förvaltning: "/>
        <br/>
        <h:outputText value="#{iFeedModelBean.department.name}"/>
    </h:panelGroup>

    <h:panelGroup rendered="#{!app.isInEditMode() and iFeedModelBean.department != null and !app.isInEditMode()}">
        <br/>
        <h:outputText style="font-weight: bold;" value="Grupp:" rendered="#{!app.isInEditMode()}"/>
        <br/>
        <h:outputText
                rendered="#{!app.isInEditMode() and iFeedModelBean.group != null and !app.isInEditMode()}"
                value="#{iFeedModelBean.group.name}"/>
    </h:panelGroup>

</ui:composition>